//2009/08/29 22:45:56
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class CollectingUsualPostmarks
{
public:
    int numberOfPostmarks(vector <int> prices, vector <int> have)
    {
        int N = have.size();
        int money = 0;
        for (int i=0; i<N; i++) money += prices[have[i]];
        sort(prices.begin(), prices.end());
        int ret = 0;
        for (int i=0; i<prices.size(); i++)
        {
            if (money >= prices[i])
            {
				cout << prices[i] <<", ";
                money -= prices[i];
                ret ++;
            }
            else break;
        }
		cout << endl;
        return ret;
    }
};
